package org.chen.exception;

public class CrawlerException extends RuntimeException {
    
    public CrawlerException(String message) {
        super(message);
    }
    
    public CrawlerException(String message, Throwable cause) {
        super(message, cause);
    }
    
    public static class SourceNotAvailableException extends CrawlerException {
        public SourceNotAvailableException(String source) {
            super("Crawler source not available: " + source);
        }
    }
    
    public static class ParsingException extends CrawlerException {
        public ParsingException(String url, Throwable cause) {
            super("Failed to parse content from: " + url, cause);
        }
    }
    
    public static class RequestFailedException extends CrawlerException {
        public RequestFailedException(String url, int statusCode) {
            super("Failed to request URL: " + url + ", status code: " + statusCode);
        }
        
        public RequestFailedException(String url, Throwable cause) {
            super("Failed to request URL: " + url, cause);
        }
    }
}